{% extends "layout/project.html" %}
{% load static %}

{% block css1 %}
<link rel="stylesheet" href="{% static 'CSS\new_project.css' %}">

{% endblock %}

{% block content1 %}
<!-- 在任务中心内容区域添加 -->
<div class="container-fluid p-0 ms-0 w-auto">
  <div class="card border-0 shadow" style="overflow: visible;">
    <div class="card-header border-bottom-0">
      <div class="d-flex justify-content-between align-items-center">
        <h5 class="mb-0">项目中心</h5>
        <button type="button" class="btn btn-outline-primary d-flex align-items-center gap-2 rounded-pill"
          data-bs-toggle="modal" data-bs-target="#newProjectModal">
          <svg width="18" height="18" fill="currentColor" class="bi bi-patch-plus" viewBox="0 0 16 16">
            <path fill-rule="evenodd"
              d="M8 5.5a.5.5 0 0 1 .5.5v1.5H10a.5.5 0 0 1 0 1H8.5V10a.5.5 0 0 1-1 0V8.5H6a.5.5 0 0 1 0-1h1.5V6a.5.5 0 0 1 .5-.5" />
            <path
              d="m10.273 2.513-.921-.944.715-.698.622.637.89-.011a2.89 2.89 0 0 1 2.924 2.924l-.01.89.636.622a2.89 2.89 0 0 1 0 4.134l-.637.622.011.89a2.89 2.89 0 0 1-2.924 2.924l-.89-.01-.622.636a2.89 2.89 0 0 1-4.134 0l-.622-.637-.89.011a2.89 2.89 0 0 1-2.924-2.924l.01-.89-.636-.622a2.89 2.89 0 0 1 0-4.134l.637-.622-.011-.89a2.89 2.89 0 0 1 2.924-2.924l.89.01.622-.636a2.89 2.89 0 0 1 4.134 0l-.715.698a1.89 1.89 0 0 0-2.704 0l-.92.944-1.32-.016a1.89 1.89 0 0 0-1.911 1.912l.016 1.318-.944.921a1.89 1.89 0 0 0 0 2.704l.944.92-.016 1.32a1.89 1.89 0 0 0 1.912 1.911l1.318-.016.921.944a1.89 1.89 0 0 0 2.704 0l.92-.944 1.32.016a1.89 1.89 0 0 0 1.911-1.912l-.016-1.318.944-.921a1.89 1.89 0 0 0 0-2.704l-.944-.92.016-1.32a1.89 1.89 0 0 0-1.912-1.911z" />
          </svg>
          创建新项目
        </button>
      </div>
    </div>

    <div class="card-body d-flex flex-column" style="height: calc(100vh - 180px);">
      <!-- 项目分类导航 -->
      <ul class="nav nav-tabs mb-4" id="projectTabs" role="tablist">
        <li class="nav-item" role="presentation">
          <a href="?type=my" class="nav-link active" id="created-tab" data-bs-toggle="tab" data-bs-target="#created"
            type="button" role="tab">
            <svg width="16" height="16" fill="currentColor" class="bi bi-person-add" viewBox="0 0 16 16">
              <path
                d="M12.5 16a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7m.5-5v1h1a.5.5 0 0 1 0 1h-1v1a.5.5 0 0 1-1 0v-1h-1a.5.5 0 0 1 0-1h1v-1a.5.5 0 0 1 1 0m-2-6a3 3 0 1 1-6 0 3 3 0 0 1 6 0M8 7a2 2 0 1 0 0-4 2 2 0 0 0 0 4" />
              <path
                d="M8.256 14a4.5 4.5 0 0 1-.229-1.004H3c.001-.246.154-.986.832-1.664C4.484 10.68 5.711 10 8 10q.39 0 .74.025c.226-.341.496-.65.804-.918Q8.844 9.002 8 9c-5 0-6 3-6 4s1 1 1 1z" />
            </svg> 我创建的项目
          </a>
        </li>
        <li class="nav-item" role="presentation">
          <a href="?type=star" class="nav-link" id="starred-tab" data-bs-toggle="tab" data-bs-target="#starred"
            type="button" role="tab">
            <svg width="16" height="16" fill="currentColor" class="bi bi-star-fill" viewBox="0 0 16 16">
              <path
                d="M3.612 15.443c-.386.198-.824-.149-.746-.592l.83-4.73L.173 6.765c-.329-.314-.158-.888.283-.95l4.898-.696L7.538.792c.197-.39.73-.39.927 0l2.184 4.327 4.898.696c.441.062.612.636.282.95l-3.522 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256z" />
            </svg> 我星标的项目
          </a>
        </li>
        <li class="nav-item" role="presentation">
          <a href="?type=join" class="nav-link" id="participated-tab" data-bs-toggle="tab"
            data-bs-target="#participated" type="button" role="tab">
            <svg width="16" height="16" fill="currentColor" class="bi bi-clipboard-check" viewBox="0 0 16 16">
              <path fill-rule="evenodd"
                d="M10.854 7.146a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L7.5 9.793l2.646-2.647a.5.5 0 0 1 .708 0" />
              <path
                d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1z" />
              <path
                d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0z" />
            </svg> 我参与的项目
          </a>
        </li>
      </ul>

      <!-- 项目筛选栏 -->
      <div class="d-flex mb-3">
        <div class="btn-group btn-group-sm">
          <button type="button" class="btn btn-outline-secondary active">全部</button>
          <button type="button" class="btn btn-outline-secondary">进行中</button>
          <button type="button" class="btn btn-outline-secondary">已完成</button>
        </div>
        <div class="ms-auto">
          <select class="form-select form-select-sm" style="width: 120px;">
            <option>最近创建</option>
            <option>最近更新</option>
            <option>按名称排序</option>
          </select>
        </div>
      </div>

      <!-- 项目内容区域 -->
      <div class="tab-content vh-100 overflow-auto" id="projectTabsContent">
        <!-- 我创建的项目 -->
        <div class="tab-pane fade show active" id="created" role="tabpanel">
          <div class="row g-3">
            <!-- 项目卡片 1 -->
            {% for item in project_dict.my %}
            <div class="col">
              <div class="card h-100 border-1 shadow-sm-hover">
                <div class="card-body" >
                  <div class="d-flex align-items-start">
                    <div class="bg-opacity-10 p-2 rounded me-3" style="background-color: {{ item.get_color_display }}">
                      <i class="bi bi-file-earmark-text text-primary"></i>
                    </div>
                    <div class="flex-grow-1">
                      <div class="d-flex justify-content-between">
                        <h6 class="mb-1">{{ item.name }}</h6>
                        <a href="{% url 'project_star' project_type='my' project_id=item.id %}" class="btn-star">
                          <i style="color: #d5d5d5;">
                            <svg width="20" height="20" fill="currentColor" class="bi bi-star" viewBox="0 0 16 16">
                              <path
                                d="M2.866 14.85c-.078.444.36.791.746.593l4.39-2.256 4.389 2.256c.386.198.824-.149.746-.592l-.83-4.73 3.522-3.356c.33-.314.16-.888-.282-.95l-4.898-.696L8.465.792a.513.513 0 0 0-.927 0L5.354 5.12l-4.898.696c-.441.062-.612.636-.283.95l3.523 3.356-.83 4.73zm4.905-2.767-3.686 1.894.694-3.957a.56.56 0 0 0-.163-.505L1.71 6.745l4.052-.576a.53.53 0 0 0 .393-.288L8 2.223l1.847 3.658a.53.53 0 0 0 .393.288l4.052.575-2.906 2.77a.56.56 0 0 0-.163.506l.694 3.957-3.686-1.894a.5.5 0 0 0-.461 0z" />
                            </svg>
                          </i>
                        </a>
                      </div>
                      <p class="text-muted small mb-2">最后更新：2小时前</p>
                      <div class="text-muted small mb-2">
                        <svg width="16" height="16" fill="currentColor" class="bi bi-person-add" viewBox="0 0 16 16">
                          <path
                            d="M12.5 16a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7m.5-5v1h1a.5.5 0 0 1 0 1h-1v1a.5.5 0 0 1-1 0v-1h-1a.5.5 0 0 1 0-1h1v-1a.5.5 0 0 1 1 0m-2-6a3 3 0 1 1-6 0 3 3 0 0 1 6 0M8 7a2 2 0 1 0 0-4 2 2 0 0 0 0 4" />
                          <path
                            d="M8.256 14a4.5 4.5 0 0 1-.229-1.004H3c.001-.246.154-.986.832-1.664C4.484 10.68 5.711 10 8 10q.39 0 .74.025c.226-.341.496-.65.804-.918Q8.844 9.002 8 9c-5 0-6 3-6 4s1 1 1 1z" />
                        </svg>
                        创建者: {{item.creator.usermail}}
                      </div>
                      <div class="text-muted small mb-2">
                        <svg width="16" height="16" fill="currentColor" class="bi bi-person" viewBox="0 0 16 16">
                          <path
                            d="M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6m2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0m4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4m-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10s-3.516.68-4.168 1.332c-.678.678-.83 1.418-.832 1.664z" />
                        </svg>
                        参与者: {{item.join_count}}
                      </div>
                      <div class="d-flex align-items-center">
                        <span class="badge bg-light text-dark me-2">设计</span>
                        <span class="badge bg-light text-dark">开发</span>
                      </div>
                    </div>
                  </div>
                  <div class="mt-3 d-flex justify-content-between align-items-center">
                    <div class="progress w-100 me-2" style="height: 6px;">
                      <div class="progress-bar bg-success" style="width: 65%"></div>
                    </div>
                    <small class="text-muted">65%</small>
                  </div>
                  <div class="mt-2">
                    <a href="#" class="btn btn-outline-primary btn-sm" style="display: inline-block;">
                      <svg width="16" height="16" fill="currentColor" class="bi bi-file-text" viewBox="0 0 16 16">
                        <path
                          d="M5 4a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1zm-.5 2.5A.5.5 0 0 1 5 6h6a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5M5 8a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1zm0 2a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1z" />
                        <path
                          d="M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2zm10-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1" />
                      </svg> 项目说明
                    </a>
                    <a href="{% url 'dashboard' project_id=item.id %}" class="btn btn-outline-primary btn-sm float-end" style="display: inline-block;">
                      <svg width="12" height="12" fill="currentColor" class="bi bi-arrow-bar-up" viewBox="0 0 16 16">
                        <path fill-rule="evenodd"
                          d="M8 10a.5.5 0 0 0 .5-.5V3.707l2.146 2.147a.5.5 0 0 0 .708-.708l-3-3a.5.5 0 0 0-.708 0l-3 3a.5.5 0 1 0 .708.708L7.5 3.707V9.5a.5.5 0 0 0 .5.5m-7 2.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5" />
                      </svg> 进入项目
                    </a>
                  </div>

                </div>
              </div>
            </div>
            {% endfor %}
          </div>
        </div>


        <!-- 我星标的项目 -->

        <div class="tab-pane fade" id="starred" role="tabpanel">
          <div class="row g-3">
            <!-- 项目卡片 1 -->
            {% for item in project_dict.star %}
            <div class="col">
              <div class="card h-100 border-1 shadow-sm-hover">
                <div class="card-body">
                  <div class="d-flex align-items-start">
                    <div class="bg-opacity-10 p-2 rounded me-3"
                      style="background-color: {{ item.value.get_color_display }}">
                      <i class="bi bi-graph-up text-success"></i>
                    </div>
                    <div class="flex-grow-1">
                      <div class="d-flex justify-content-between">
                        <h6 class="mb-1">{{item.value.name}}</h6>
                        <a href="{% url 'project_unstar' project_type=item.type project_id=item.value.id %}">
                          <i style="color: #FFC706;">
                            <svg width="18" height="18" fill="currentColor" class="bi bi-star-fill" viewBox="0 0 16 16">
                              <path
                                d="M3.612 15.443c-.386.198-.824-.149-.746-.592l.83-4.73L.173 6.765c-.329-.314-.158-.888.283-.95l4.898-.696L7.538.792c.197-.39.73-.39.927 0l2.184 4.327 4.898.696c.441.062.612.636.282.95l-3.522 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256z" />
                            </svg>
                          </i>
                        </a>
                      </div>
                      <p class="text-muted small mb-2">最后更新：3天前</p>
                      <div class="text-muted small mb-2">
                        <svg width="16" height="16" fill="currentColor" class="bi bi-person-add" viewBox="0 0 16 16">
                          <path
                            d="M12.5 16a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7m.5-5v1h1a.5.5 0 0 1 0 1h-1v1a.5.5 0 0 1-1 0v-1h-1a.5.5 0 0 1 0-1h1v-1a.5.5 0 0 1 1 0m-2-6a3 3 0 1 1-6 0 3 3 0 0 1 6 0M8 7a2 2 0 1 0 0-4 2 2 0 0 0 0 4" />
                          <path
                            d="M8.256 14a4.5 4.5 0 0 1-.229-1.004H3c.001-.246.154-.986.832-1.664C4.484 10.68 5.711 10 8 10q.39 0 .74.025c.226-.341.496-.65.804-.918Q8.844 9.002 8 9c-5 0-6 3-6 4s1 1 1 1z" />
                        </svg>
                        创建者: {{item.value.creator.usermail}}
                      </div>
                      <div class="text-muted small mb-2">
                        <svg width="16" height="16" fill="currentColor" class="bi bi-person" viewBox="0 0 16 16">
                          <path
                            d="M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6m2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0m4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4m-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10s-3.516.68-4.168 1.332c-.678.678-.83 1.418-.832 1.664z" />
                        </svg>
                        参与者: {{item.value.join_count}}
                      </div>
                      <div class="d-flex align-items-center">
                        <span class="badge bg-light text-dark me-2">BI</span>
                        <span class="badge bg-light text-dark">大数据</span>
                      </div>
                    </div>
                  </div>
                  <div class="mt-3 d-flex justify-content-between align-items-center">
                    <div class="progress w-100 me-2" style="height: 6px;">
                      <div class="progress-bar bg-primary" style="width: 90%"></div>
                    </div>
                    <small class="text-muted">90%</small>
                  </div>
                  <div class="mt-2">
                    <a href="#" class="btn btn-outline-primary btn-sm" style="display: inline-block;">
                      <svg width="16" height="16" fill="currentColor" class="bi bi-file-text" viewBox="0 0 16 16">
                        <path
                          d="M5 4a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1zm-.5 2.5A.5.5 0 0 1 5 6h6a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5M5 8a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1zm0 2a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1z" />
                        <path
                          d="M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2zm10-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1" />
                      </svg> 项目说明
                    </a>
                    <a href="{% url 'dashboard' project_id=item.value.id %}" class="btn btn-outline-primary btn-sm float-end" style="display: inline-block;">
                      <svg width="12" height="12" fill="currentColor" class="bi bi-arrow-bar-up" viewBox="0 0 16 16">
                        <path fill-rule="evenodd"
                          d="M8 10a.5.5 0 0 0 .5-.5V3.707l2.146 2.147a.5.5 0 0 0 .708-.708l-3-3a.5.5 0 0 0-.708 0l-3 3a.5.5 0 1 0 .708.708L7.5 3.707V9.5a.5.5 0 0 0 .5.5m-7 2.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5" />
                      </svg> 进入项目
                    </a>
                  </div>
                </div>
              </div>
            </div>
            {% endfor %}
          </div>
        </div>


        <!-- 我参与的项目 -->

        <div class="tab-pane fade" id="participated" role="tabpanel">
          <div class="row g-3">
            {% for item in project_dict.join %}
            <!-- 项目卡片 1 -->
            <div class="col">
              <div class="card h-100 border-1 shadow-sm-hover">
                <div class="card-body">
                  <div class="d-flex align-items-start">
                    <div class="bg-opacity-10 p-2 rounded me-3" style="background-color: {{ item.get_color_display }}">
                      <i class="bi bi-kanban text-warning"></i>
                    </div>
                    <div class="flex-grow-1">
                      <div class="d-flex justify-content-between">

                        <h6 class="mb-1">{{item.name}}</h6>
                        <a href="{% url 'dashboard' project_id=item.id %}">
                          <i style="color: #d5d5d5;">
                            <svg width="20" height="20" fill="currentColor" class="bi bi-star" viewBox="0 0 16 16">
                              <path
                                d="M2.866 14.85c-.078.444.36.791.746.593l4.39-2.256 4.389 2.256c.386.198.824-.149.746-.592l-.83-4.73 3.522-3.356c.33-.314.16-.888-.282-.95l-4.898-.696L8.465.792a.513.513 0 0 0-.927 0L5.354 5.12l-4.898.696c-.441.062-.612.636-.283.95l3.523 3.356-.83 4.73zm4.905-2.767-3.686 1.894.694-3.957a.56.56 0 0 0-.163-.505L1.71 6.745l4.052-.576a.53.53 0 0 0 .393-.288L8 2.223l1.847 3.658a.53.53 0 0 0 .393.288l4.052.575-2.906 2.77a.56.56 0 0 0-.163.506l.694 3.957-3.686-1.894a.5.5 0 0 0-.461 0z" />
                            </svg>
                          </i>
                        </a>
                      </div>
                      <p class="text-muted small mb-2">最后更新：1天前</p>
                      <div class="d-flex align-items-center">
                        <span class="badge bg-light text-dark me-2">前端</span>
                        <span class="badge bg-light text-dark">后端</span>
                      </div>
                    </div>
                  </div>
                  <div class="mt-3 d-flex justify-content-between align-items-center">
                    <div class="progress w-100 me-2" style="height: 6px;">
                      <div class="progress-bar bg-info" style="width: 45%"></div>
                    </div>
                    <small class="text-muted">45%</small>
                  </div>
                  <div class="mt-2">
                    <a href="#" class="btn btn-outline-primary btn-sm" style="display: inline-block;">
                      <svg width="16" height="16" fill="currentColor" class="bi bi-file-text" viewBox="0 0 16 16">
                        <path
                          d="M5 4a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1zm-.5 2.5A.5.5 0 0 1 5 6h6a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5M5 8a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1zm0 2a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1z" />
                        <path
                          d="M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2zm10-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1" />
                      </svg> 项目说明
                    </a>
                    <a href="{% url 'dashboard' project_id=item.id %}" class="btn btn-outline-primary btn-sm float-end" style="display: inline-block;">
                      <svg width="12" height="12" fill="currentColor" class="bi bi-arrow-bar-up" viewBox="0 0 16 16">
                        <path fill-rule="evenodd"
                          d="M8 10a.5.5 0 0 0 .5-.5V3.707l2.146 2.147a.5.5 0 0 0 .708-.708l-3-3a.5.5 0 0 0-.708 0l-3 3a.5.5 0 1 0 .708.708L7.5 3.707V9.5a.5.5 0 0 0 .5.5m-7 2.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5" />
                      </svg> 进入项目
                    </a>
                  </div>
                </div>
              </div>
            </div>
            {% endfor %}
          </div>
        </div>


        <!-- 分页 -->
        
      </div>
    </div>
  </div>

  <!-- 新建项目模态框 -->
  <div class="modal fade" id="newProjectModal" tabindex="-1">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <h5 class="modal-title">新建项目</h5>
          <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
        </div>
        <div class="modal-body">
          <form id="addForm">
            {% csrf_token %}
            {% for field in form %}
            <div class="mb-3">
              <label class="form-label">{{ field.label }}</label>
              {{ field }}
              <div class="text-danger" style="margin-left: 4px;position: absolute;font-size: 14px;"></div>
            </div>

            {% endfor %}
          </form>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
          <button id="btnSubmit" type="button" class="btn btn-primary">创建项目</button>
        </div>
      </div>
    </div>
  </div>

  <script>

  </script>


{% endblock %}



  {% block js1 %}
  <script>
    document.querySelectorAll('.nav-link').forEach(link => {
      link.addEventListener('click', function (e) {
        e.preventDefault(); // 阻止默认跳转

        // 切换活跃的标签页
        document.querySelectorAll('.nav-link').forEach(el => el.classList.remove('active'));
        this.classList.add('active');

        // 更新浏览器 URL 而不刷新页面
        const newUrl = this.getAttribute('href');
        window.history.pushState({}, '', newUrl);

        // 手动触发内容加载（这里需要你自己实现）
        loadTabContent(newUrl);
      });
    });

    function loadTabContent(url) {
      // 这里实现通过 AJAX 加载内容的逻辑
      console.log('加载内容:', url);
      // 示例: fetch(url).then(...).then(...)
    }
    
});
  </script>
  
  <script>
    $(function () {

      bindSubmit();

    })

    function bindSubmit() {
      $('#btnSubmit').click(function () {
        // 点击清空错误信息
        $('.text-danger').empty()
        $.ajax({
          url: '/project/list/',
          type: 'POST',
          data: $('#addForm').serialize(),
          dataType: 'JSON',
          success: function (res) {
            console.log(res)

            if (res.status) {
              location.reload()
            } else {
              $.each(res.error, function (key, value) {
                $("#id_" + key).next().text(value[0])
              })
            }
          }

        })
      })

    }
  
  </script>

  {% endblock %}